package com.phone.core.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CommonUtil {
	public static final String SUCCESS = "0000";
    public static final String FAILED = "1111";
    public static final String MSG_SUCCESS="请求成功";
    public static final String MSG_FAILED="请求失败";

    /**
     * 显示到页面-成功
     * @author  陈嘉瑛
     * @version  2016-11-29
     * @param msg
     * @param data
     * @return
     */
    public static Map<String,Object> responseSuccess(String msg, Object data) {
    	Map<String,Object> jo = new HashMap<String,Object>();
        jo.put("code", SUCCESS);
        jo.put("msg", msg);
        jo.put("data", data);
        return jo;
    }
    
    /**
     * 响应到页面-失败
     * @author  陈嘉瑛
     * @version  2016-11-29
     * @param msg
     * @param data
     * @return
     */
    public static Map<String,Object> responseError(String msg, Object data) {
    	Map<String,Object> jo = new HashMap<String,Object>();
        jo.put("code", FAILED);
        jo.put("msg", msg);
        jo.put("data", data);
        return jo;
    }
    

}
